<!DOCTYPE html>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<meta name="viewport" content="width=device-width, initial-scale=1.0, minimum-scale=1.0, maximum-scale=1.0, user-scalable=no" />
<meta name="format-detection" content="telephone=no,email=no,adress=no"/>
<title>先花花</title>
<link rel="stylesheet" type="text/css" href="css/common.css" />
<script type="text/javascript" src="script/jquery.js"></script>
<script type="text/javascript" src="script/column.js"></script>
</head>
<body onload="load()">
<!--浮动-->
<!--浮动-->
<div class="dropMask"></div>
<div class="dragBtn"></div>
<div class="dropBox">
  <div class="dropSkin"></div>
  <!-- 请求地址 -->
<ul class="dropList">
     <li class="nth-child_1"> <a href="index.html" class="dropIco"></a>
      <p>首页</p>
    </li>
    <li class="nth-child_2"> <a href="list.html" class="dropIco"></a>
      <p>投资</p>
    </li>
    <li class="nth-child_3"> <a href="user.html" class="dropIco"></a>
      <p>个人中心</p>
    </li>
    <li class="nth-child_4"> <a href="register.html" class="dropIco"></a>
      <p>注册</p>
    </li>
    <li class="nth-child_5"> <a href="login.html" class="dropIco"></a>
      <p>登录</p>
    </li>

  </ul>
</div>
<script src="script/index.js"></script>
<script src="script/jquery-ui.min.js"></script>
<!-- 页面头部 -->
<section>
 <div class="navigation-bar"> <a href="javascript:history.back(-1)" class="z-01"></a> <span>理财</span> <a href="index.html" class="z-02"></a> </div>
</section>
<!-- 中间内容 -->
<div class="main">
  <div class="cre-tabs">
    <div class="tab-border"></div>
    <a id="one1" onClick="setTab('one',1,4)" class="hover">项目期限</a> <span class="split-line ">|</span><a id="one2" onClick="setTab('one',2,4)">项目状态</a> <span class="split-line ">|</span><a id="one3" onClick="setTab('one',3,4)">还款方式</a> <span class="split-line ">|</span><a id="one4" onClick="setTab('one',4,4)">分站区域</a> </div>
  <div class="invest_menuinfo" id="con_one_1">
    <div class="clear"></div>
    <ul class="term">
      <li value="2"><a href="#">3个月</a></li>
      <li value="5"><a href="#">6个月</a></li>
      <li value="11"><a href="#">一年</a></li>
    </ul>
  </div>
  <div class="invest_menuinfo" id="con_one_2" style="display:none">
    <ul class="term">
      <li value="1"><a href="#">即将上线</a></li>
      <li value="2"><a href="#">正在募集</a></li>
      <li value="3"><a href="#">正在回款</a></li>
      <li value="0"><a href="#">回款完毕</a></li>
    </ul>
  </div>
  <div class="invest_menuinfo" id="con_one_3" style="display:none">
    <ul class="term">
      <li value="0"><a href="#">按月付息，到期还本</a></li>
      <li value="1"><a href="#">一次性还款</a></li>
    </ul>
  </div>
  <div class="invest_menuinfo" id="con_one_4" style="display:none">
    <h2>分站区域</h2>
    <div class="cityen"> <a href="#" class="on">A</a><a href="#">B</a><a href="#">C</a><a href="#">D</a><a href="#">E</a><a href="#">F</a><a href="#">G</a><a href="#">H</a><a href="#">I</a><a href="#">J</a><a href="#">K</a><a href="#">L</a><a href="#">M</a><a href="#">N</a><a href="#">O</a><a href="#">P</a><a href="#">Q</a><a href="#">R</a><a href="#">S</a><a href="#">T</a><a href="#">U</a><a href="#">V</a><a href="#">W</a><a href="#">X</a><a href="#">Y</a><a href="#">Z</a></div>
    <div class="cityname"><a href="#" class="on">安徽合肥</a></div>
  </div>
  <div class="index-list-wrap">
    <!--车-->
   
    <!--end-->
  </div>
  <div class="UpPage"></div>
</div>
  
<!-- 页面底部 -->
<nav class="footer border_t" id="footer"> <a href="index.html" class="" id="jx"><span></span>首页</a> <a href="list.html" id="lc" class="nav_on"><span></span>理财</a> <a href="borrow_money.html" id="jk" class=""><span></span>借款</a> <a href="user.html" id="cf" class=""><span></span>我的账户</a> </nav>
</body>
</html>
<script type="text/javascript" src="script/jquery.cookie.js"></script>
<script type="text/javascript" src="script/jquery.md5.js"></script>
<script>
  function load(){
    var name = $('.hover').attr('id');
    $('#con_one_1 ul.term li:first').addClass('select');
    get_Ajax('product');
  };
  $(function(){
    $('.cre-tabs a').click(function(){
      var name = $(this).attr('id');
      $('ul.term li.select').removeClass();
      $('#con_one_'+name.slice(3)+' ul.term li:first').addClass('select');
      // alert(aa)
      // $('.invest_menuinfo')
      var type = $('.select').attr('value');
      // alert(type);return false;
      get_Ajax('product',1,5,name,type);
    })
    
  })
   
  $('ul li').click(function(){
    $('ul li.select').removeClass();
    $(this).addClass('select');
    var name = $('.hover').attr('id');
    var type = $(this).attr('value');
    // alert(type);return false;
    // get_where(name,type);
    get_Ajax('product',1,5,name,type);
  })
  $(document).on('click','.UpPage a',function(){
    var np=$('#np').html();
    var sp=$('#sp').html();
    var name = $('.hover').attr('id');
    var go=$(this).attr('name');
    var type = $('.select').attr('value');
    if(go=='last'){
      if(parseInt(np)>1){
        get_Ajax('product',parseInt(np)-1,5,name,type);
      }else{
        alert('亲！已经是第一页了');return false;
      }
    }else{
      // alert(np+sp)
      if(parseInt(sp)-parseInt(np)){
        get_Ajax('product',parseInt(np)+1,5,name,type);
      }else{
        alert('亲！已经是最后一页了');return false;
      }
    }
  })
  function infor(productId,schedule){
      storage=window.localStorage;
  uid = storage['userid'];
    if(isNaN(uid)){
              location.href='infor.html?goods='+productId;
           }else{
             location.href='infor4.html?goods='+productId;
           }
  }
  function get_Ajax(table='product',page=1,size=5,name='one1',type='2'){
    // alert(1)
    $.ajax({
      type:"get",
      url:"http://47.93.21.169/old/TP5/public/index.php/index/product/productList",
      dataType:'JSONP',
      data:{"table":table,"page":page,"size":size,"name":name,"type":type},
      jsonp:'callback',
      success:function(e){
        console.log(e);
        if(e.data.length===0){  
          $('.UpPage').html('');
          $('.index-list-wrap').html("暂无相关产品"); 
          $('ul li.select').removeClass();
          $('#con_one_'+name.slice(3)+' ul.term li:first').addClass('select');
          return false;
        }
        var str='';
        $.each(e.data,function(k,v){
          str+='<div class="index-pad" name="'+v.productId+'"> <a class="index-list index-che" onClick="infor('+v.productId+')" href="javascript:void(0)"><div class="list-tit clear"> <span class="fl tit-name"><i></i>';
          str+='<strong>'+v.productName+'</strong></span> <span class="fr tit-site"><i></i> ';
          str+='<strong>内蒙古锡林格勒蒙古 </strong> </span> </div><div class="list-main"><div class="main-l">';
          str+=' <span class="per">'+v.interestRate*100+'<i>%</i></span>  <span class="add">A</span> </div><div class="main-m main-m-1"> ';
          str+='<span>'+v.totalSum/10000+'<i>万</i></span> </div><div class="main-m main-m-2"> <span class="day">';
          if(v.deadLine=='2'){
            str+=3*30;
          }else if(v.deadLine=='5'){
            str+=6*30;
          }else if(v.deadLine=='11'){
            str+=12*30;
          }
          if(v.bi=='a'){
            str+='<i>天</i></span> </div><div class="main-r"> <span class="circle-gray"></span> <span class="val-txt">即将上线</span> </div></div></a></div>';
          }else if(v.bi=='b'){
            str+='<i>天</i></span> </div><div class="main-r"> <span class="circle-gray"></span> <span class="val-txt">回款中</span> </div></div></a></div>';
          }else if(v.bi=='c'){
            str+='<i>天</i></span> </div><div class="main-r"> <span class="circle-gray"></span> <span class="val-txt">已结束</span> </div></div></a></div>';
          }else{
            str+='<i>天</i></span> </div><div class="main-r"> <span class="circle-blue circle-c'+v.bi+'"></span> <span class="val-per">'+v.bi+'<i>%</i></span> </div></div></a></div>';
          }
        })
      var last = e.page-1>0?e.page-1>0:1;
       var next = e.page+1>e.page_tota?e.page_tota:e.page+1;
        $('.UpPage').html(' <ul> <li><a href="javascript:void(0)" name="last">上一页</a></li><li><span><font id="np">'+e.page+'</font>/<font id="sp">'+e.page_total+'</font></span></li><li><a href="javascript:void(0)" name="next">下一页</a></li></ul>');
        $('.index-list-wrap').html(str); 
      }
    })
  }
</script>
